import config from "uview-ui/libs/config/config";

const http = uni.$u.http
import store from '@/store'
function getConfig(config) {
    return {
        ...config,
        header: {
            Accept: 'application/json'
        }
    }
}
// post请求，获取菜单
export default {
    bannerList: (data, config = {}) => http.get('/banner/list'),
    bannerDetail: (id, config = {}) => http.get('/banner/detail?id=' + id),
    // 农场
    companyList: (data, config = {}) => http.get('/company/list'),
    // 饲料种类
    getMatList: (data, config = {}) => http.get(`/mat/list?date=${data.date}&company_id=${store.state.farm.value}`),
    // 仓库数据
    getStoreList: (data, config = {}) => http.get(`/storeRecord/list?date=${data.date}&company_id=${store.state.farm.value}&type=${data.type}`),
    // 饲料平均价格
    getMatinAvgPrice: (data, config = {}) => http.get(`/matin/avgPrice?company_id=${store.state.farm.value}&mat=${data.mat}`),
    // 牛宿
    getRoomList: (data, config = {}) => http.get('/room/list?company_id=' + store.state.farm.value),
    // 牛舍设备
    getDeviceByRoom: (data, config = {}) => http.get(`/device/list?room_id=${data.room_id}&company_id=${store.state.farm.value}`),
    getCameraByRoom: (data, config = {}) => http.get(`/camera/list?room_id=${data.room_id}&company_id=${store.state.farm.value}`),
    // 设备故障 /api/deviceFaults/list
    getDeviceFaults: (data, config = {}) => http.get(`/deviceFaults/list?room_id=${data.room_id}&company_id=${store.state.farm.value}&status=${data.status}&date=${data.date}`),

    /**
     * 牛
     */
    // 牛分组
    getBeefGroupList: (data, config = {}) => http.get(`/beefGroup/list?company_id=${store.state.farm.value}`),
    // 牛进出栏
    getBeefInOutList: (data, config = {}) => http.get(`/beefInOut/list?company_id=${store.state.farm.value}`),
    /**
     * 预警
     */
    // 告警统计
    getAlarmCount: (data, config = {}) => http.get(`/alarm/list?company_id=${store.state.farm.value}`),
    // 删除告警
    deleteAlarm: (data, config = {}) => http.post(`/alarm/delete`, data),
    // 处理告警
    handleAlarm: (data, config = {}) => http.post(`/alarm/handle`, data),
    /**
     * 考勤数据
     */
    getAttendanceData: (data, config = {}) => http.get(`/workLog/today?company_id=${store.state.farm.value}`),
    /**
     *
     */
    getAgeDistribution: (data, config = {}) => http.get(`/staff/ageDistribution?company_id=${store.state.farm.value}`),
    /**
     * 登录
     */
    login: (data, config = {}) => http.post(`/user/login`, data),
    // 生产计划
    getPlanList: (data, config = {}) => http.get(`/plan/list?company_id=${store.state.farm.value}`),

    // 繁育指标数据
    getBreedIndex: (data, config = {}) => http.get(`/breed/index?company_id=${store.state.farm.value}&breed=${data.breed || ''}`),
    // 疾病情况
    getDiseaseList: (data, config = {}) => http.get(`/disease/list?company_id=${store.state.farm.value}&breed=${data.breed || ''}`),
}
